#define _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>
#include <string.h>

void replaceSpace(char *str, int length) {
	char* tmp = "%20";
	char arr[100] = { 0 };
	char larr[100] = { 0 };
	strcpy(arr, str);
	char* lp;
	int m = 0;
	for (m = 0; *(str + m) != '\0'; m++)
	{
		;
	}

	const char * p = " ";
	lp = strtok(arr, p);
	strcpy(larr, lp);
	strcat(larr, tmp);
	int n = 1;
	for (lp = strtok(NULL, p); lp != NULL; lp = strtok(NULL, p))
	{
		strcat(larr, lp);
		strcat(larr, tmp);
		n++;
	}
	strcpy(str, larr);
	*(str + m + 2 * n - 2) = '\0';
	printf("%s", str);
}


int main()
{
	int n = 0;
	//scanf("%d", &n);
	char* p = "we are young";
	replaceSpace(p, 12);
	

	return 0;
}